﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterAdmin.master" AutoEventWireup="true" CodeBehind="Showsalary.aspx.cs" Inherits="Project_Udrinkwater.PagesAdmin.Showsalary" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <dx:ASPxRoundPanel ID="RPN_Showsalary" runat="server" Width="100%" 
        HeaderText="ข้อมูลเงินเดือนพนักงาน">
        <HeaderStyle Font-Size="Medium" HorizontalAlign="Left" />
        <PanelCollection>
<dx:PanelContent runat="server" SupportsDisabledAttribute="True">
    <div>
        
        <table align="right">
            <tr>
                <td>
                    <dx:ASPxButton ID="Export_XlsPrivot" runat="server" 
                        OnClick="Export_XlsPrivot_Click" Text="พิมพ์รายงาน Excel">
                    </dx:ASPxButton>
                </td>
                <td>
                    <dx:ASPxButton ID="Export_PdfPrivot" runat="server" Text="พิพม์รายงาน PDF" 
                        OnClick="Export_PdfPrivot_Click">
                    </dx:ASPxButton>
                </td>
            </tr>
        </table>
        
    </div>
      <dx:ASPxPivotGrid ID="PVG_ShowsalaryEmp" runat="server" ClientIDMode="AutoID" 
        DataSourceID="SqlDataSource_Showsalary" Width="100%">
        <Fields>
            <dx:PivotGridField ID="fieldColumn1" Area="RowArea" AreaIndex="0"  
                Caption="พนักงาน" FieldName="Column1">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryStartMonth" Area="RowArea" AreaIndex="1"
                Caption="เดือน" FieldName="Salary_StartMonth" 
                GroupInterval="DateMonth" UnboundFieldName="fieldSalaryStartMonth" 
                CellFormat-FormatString="MMMM">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalaryEndMonth" Area="ColumnArea" AreaIndex="0" 
                Caption="ปี" FieldName="Salary_EndMonth" GroupInterval="DateYear" 
                UnboundFieldName="fieldSalaryEndMonth">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldOT" Area="DataArea" AreaIndex="2" 
                Caption="ทำงานล่วงเวลา" FieldName="OT">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldReduceAbsence" Area="DataArea" AreaIndex="4" 
                Caption="ค่าปรับขาดงาน" FieldName="Reduce_Absence">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldReduceWithdraw" Area="DataArea" AreaIndex="3" 
                Caption="เบิกจ่ายล่วงหน้า" FieldName="Reduce_Withdraw">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldReduceOther" Area="DataArea" AreaIndex="5" 
                Caption="อื่นๆ" FieldName="Reduce_Other">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldCommission" Area="DataArea" AreaIndex="1" 
                Caption="ค่าคอมมิชชั่น" FieldName="Commission">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldSalary" Area="DataArea" AreaIndex="0" 
                Caption="เงินเดือน" FieldName="Salary">
            </dx:PivotGridField>
            <dx:PivotGridField ID="fieldTotalSalary" Area="DataArea" AreaIndex="6" 
                Caption="เงินเดือนสุทธิ" FieldName="TotalSalary">
            </dx:PivotGridField>
        </Fields>
          <OptionsView ShowDataHeaders="False" ShowFilterHeaders="False" 
              ShowHorizontalScrollBar="True" />
<StylesPrint Cell-BackColor2="" Cell-GradientMode="Horizontal" FieldHeader-BackColor2="" FieldHeader-GradientMode="Horizontal" TotalCell-BackColor2="" TotalCell-GradientMode="Horizontal" GrandTotalCell-BackColor2="" GrandTotalCell-GradientMode="Horizontal" CustomTotalCell-BackColor2="" CustomTotalCell-GradientMode="Horizontal" FieldValue-BackColor2="" FieldValue-GradientMode="Horizontal" FieldValueTotal-BackColor2="" FieldValueTotal-GradientMode="Horizontal" FieldValueGrandTotal-BackColor2="" FieldValueGrandTotal-GradientMode="Horizontal" Lines-BackColor2="" Lines-GradientMode="Horizontal"></StylesPrint>
    </dx:ASPxPivotGrid>
    <dx:ASPxPivotGridExporter ID="PVG_ExportSalary" runat="server" 
          ASPxPivotGridID="PVG_ShowsalaryEmp" 
        OnCustomExportCell="PVG_ExportSalary_CustomExportCell">
        <OptionsPrint PrintDataHeaders="False" PrintFilterHeaders="True" 
            PrintHorzLines="True" PrintRowHeaders="True" PrintVertLines="True">
            <PageSettings Margins="80, 0, 100, 0" />
        </OptionsPrint>
    </dx:ASPxPivotGridExporter>
      <asp:SqlDataSource ID="SqlDataSource_Showsalary" runat="server" 
          ConnectionString="<%$ ConnectionStrings:DB_Udrink %>" 
          SelectCommand="SELECT TB_Salary.Employee_ID+'  '+TB_Employee.Firstname, TB_Salary.Salary_StartMonth, TB_Salary.Salary_EndMonth, TB_Salary.OT, TB_Salary.Reduce_Absence, TB_Salary.Reduce_Withdraw, TB_Salary.Reduce_Other, TB_Salary.Commission, TB_Employee.Salary,((TB_Employee.Salary+TB_Salary.OT+TB_Salary.Commission)-(TB_Salary.Reduce_Absence+TB_Salary.Reduce_Withdraw+TB_Salary.Reduce_Other)) AS TotalSalary FROM TB_Salary INNER JOIN TB_Employee ON TB_Salary.Employee_ID = TB_Employee.Employee_ID ">
      </asp:SqlDataSource>
</dx:PanelContent>
</PanelCollection>
    </dx:ASPxRoundPanel>
</asp:Content>
